package ljl.codetop300;

public class _26_remove_duplicates {

  /**
   * 双指针，没意思
   * 0 0 1 1 2 3
   */
  public int removeDuplicates(int[] nums) {
    int j = 1;
    for (int i = 1; i < nums.length; i++) {
      if (nums[i] != nums[i - 1]) {
        nums[j++] = nums[i];
      }
    }
    return j;
  }
}
